<include file="public@header">
<style>
    .z_hqdiv{
        padding: 0.3rem 0.4rem;
        font-size: 0;
    }
    .z_hqdiv .indexlist_z{
        padding-top: 0.01rem;
    }
    .z_hqdiv .indexlistnav{
        padding: 0.27rem;
        border-bottom: 0.01rem solid #646b77;
        background: #1f2630;
    }
</style> 
<body>
    <div class="bgbg headhead">
        <p class="mytitle">{:lang('Markets')}</p>
        <div class="z_hqdiv">
            <div class="indexlistnav">
                <div>{:lang('Name')}</div>
                <div>{:lang('Market Price')}</div>
                <div>{:lang('Change')}</div>
            </div>
            <div class="indexlist_z indexlist_zf">
                <foreach name="symbol_list" item="vo">
                    <div class="indexlistshow">
                        <div class="listshow1">
                            <p>{$vo.name}<span>/USDT</span></p>
                            <p>24H <i id="{$vo.name}_v">{$vo.v}</i></p>
                        </div>
                        <div class="listshow1">
                            <p id="{$vo.name}_price">{:floatval($vo.price)}</p>
                            <p id="{$vo.name}_price_rmb">￥{:round(get_usdt()*$vo.price,2)}</p>
                        </div>
                        <div>
                            <p class="upup" style="background-color:green;" id="{$vo.name}_zf"></p>
                        </div>
                    </div>
                </foreach>
            </div>
        </div>
    </div>
    <include file="public@navbar">
    <script src="__STATIC__/js/jquery.js"></script>
    <script>
        $('.indexlisthead div').click(function(){
            let $this = $(this);
            $this.siblings().removeClass('active');
            $this.addClass('active');
            $this.parent().siblings().hide();
            let type = $this.attr('data-type');
            $('.' + type).show();
        });

        var ustd_price = '{:get_usdt()}';
        function get_new_symbol_price(){
            $.ajax({
                type: 'get',
                url: '{:url("portal/index/get_new_symbol_price")}',
                success:function(res){
                    console.log(res)
                    for(var key in res){
                        if(res[key].zf < 0){
                            $('#'+res[key].name+'_price').html(parseFloat(res[key].price));
                            $('#'+res[key].name+'_zf').html(res[key].zf+'%');
                            $('#'+res[key].name+'_price').css("color","red");
                            $('#'+res[key].name+'_zf').css("background-color","red");
                        }else{
                            $('#'+res[key].name+'_price').html(parseFloat(res[key].price));
                            $('#'+res[key].name+'_zf').html('+'+res[key].zf+'%');
                            $('#'+res[key].name+'_price').css("color","green");
                            $('#'+res[key].name+'_zf').css("background-color","green");
                        }
                        $('#'+res[key].name+'_price_rmb').html('￥'+(res[key].price*ustd_price).toFixed(2));
                        $('#'+res[key].name+'_v').html(parseFloat(res[key].v));
                    }
                }
            });
            setTimeout('get_new_symbol_price()',1000);
        }
        get_new_symbol_price();
    </script>
</body>
</html>